package com.abchina.szh.grass.common;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;


public class LambdaTest {

	public static void main(String[] args) {
		System.out.println("Hello Grass");
		
		// 示例1
		Arrays.asList( "a", "b", "d" ).forEach( e -> System.out.println( e ) );
		
		// 示例2，Thread
		Thread td = new Thread(() -> System.out.println("Hello, Lambda!"));
		td.start();

		// 示例3，Collections
		List<String> list = Arrays.asList(new String[] { "b", "c", "a" });
		System.out.println(list.toString());

//        Collections.sort(list, new Comparator<String>() {
//            @Override
//            public int compare(String str1, String str2){
//                return str1.compareTo(str2 );
//            }
//        });
		Collections.sort(list, (str1, str2) -> str1.compareTo(str2));

		System.out.println(list.toString());

	}
}
